1 00:00:00,360 --> 00:00:06,510 Let's add configuration variables to our sponsors so that we can easily change things like intermission 2 00:00:06,510 --> 00:00:08,220 time and round time. 3 00:00:08,220 --> 00:00:13,690 And we also want some sort of flag to turn the sponsor on and off. 4 00:00:13,710 --> 00:00:20,280 Well, the easiest way to do that, come over here to your server script service, open it up and on 5 00:00:20,280 --> 00:00:25,410 your sponsor script, we're going to add the configuration variables directly to it. 6 00:00:25,470 --> 00:00:31,140 So I'll hit this plus here and then hit an I four in value. 7 00:00:31,470 --> 00:00:33,180 And then we got this in value. 8 00:00:33,180 --> 00:00:34,890 It holds integers, right? 9 00:00:34,980 --> 00:00:36,720 It's an object that holds integers. 10 00:00:36,720 --> 00:00:43,320 I'm going to call this intermission and that intermission, I'll just make that 5 seconds just like 11 00:00:43,320 --> 00:00:45,150 it was in this script. 12 00:00:45,270 --> 00:00:48,780 And then I'm going to hit that plus sign again in value. 13 00:00:48,810 --> 00:00:50,520 This is going to be the round. 14 00:00:52,310 --> 00:00:55,970 Here we go round cool. 15 00:00:55,970 --> 00:00:58,220 And then we'll make this value 25. 16 00:00:58,220 --> 00:01:03,620 That's what it was in the script and we'll add another one plus value. 17 00:01:03,620 --> 00:01:06,050 This one will be this is going to be a new one. 18 00:01:06,050 --> 00:01:12,980 We don't have in the script time to live because we're destroying all the zombies at the end of the 19 00:01:12,980 --> 00:01:13,460 loop. 20 00:01:13,460 --> 00:01:16,610 But we might want the zombies to live longer than the loop. 21 00:01:16,610 --> 00:01:19,910 So did you have more than one wave that you have to deal with? 22 00:01:20,090 --> 00:01:20,600 Right. 23 00:01:20,600 --> 00:01:27,860 So let's go to value on that and I'm going to make this 45 seconds slightly longer than my round so 24 00:01:27,860 --> 00:01:30,530 that I could see two sets of zombies in the world. 25 00:01:31,070 --> 00:01:32,600 All right, one more value. 26 00:01:32,960 --> 00:01:36,140 Go here to the Z spawn or hit the plus. 27 00:01:36,770 --> 00:01:45,620 I want to be for Boolean boolean and this is going to say activated, right? 28 00:01:45,710 --> 00:01:48,170 That's going to be true or false Boolean value. 29 00:01:48,200 --> 00:01:50,150 You're just going to select that flag. 30 00:01:50,150 --> 00:01:52,460 So if you haven't checked, that's a true. 31 00:01:52,460 --> 00:01:54,530 If it's not checked, it's a false. 32 00:01:54,830 --> 00:02:01,700 All right, let's go into our code, open up Z spanner and implement those values to scroll up here. 33 00:02:01,910 --> 00:02:07,760 We do have an intermission, but we want to use the one that's on the script in the INT value. 34 00:02:07,760 --> 00:02:15,380 So I'm going to say script colon, wait for child just in case these int values aren't aren't they're 35 00:02:15,410 --> 00:02:23,090 on startup right away or immediately I should say, let's get our intermission and then we'll do another 36 00:02:23,090 --> 00:02:25,070 one for round script. 37 00:02:25,070 --> 00:02:28,370 Colon Wait for child round. 38 00:02:29,090 --> 00:02:30,740 I need time to live. 39 00:02:30,740 --> 00:02:33,740 I'll call that total script. 40 00:02:33,860 --> 00:02:37,310 Colon Wait for child time to live. 41 00:02:37,760 --> 00:02:45,410 And we need our activated, activated script waiting for child activated. 42 00:02:45,410 --> 00:02:46,310 Nice. 43 00:02:47,560 --> 00:02:47,950 All right. 44 00:02:47,950 --> 00:02:49,820 So what I think I'm going to do here. 45 00:02:49,840 --> 00:02:53,650 So intermission was a variable to a number. 46 00:02:53,680 --> 00:02:55,990 Now it's a variable to an invalid. 47 00:02:56,020 --> 00:03:00,800 So in order to get the actual value, you have to do this dot value. 48 00:03:00,820 --> 00:03:01,300 Right. 49 00:03:01,300 --> 00:03:05,580 So if you look at your intermission here, you have that value field. 50 00:03:05,590 --> 00:03:09,120 You have to access the field in order to get the five right. 51 00:03:09,160 --> 00:03:13,150 And then we have the same thing going on for round dot value. 52 00:03:13,600 --> 00:03:14,380 Cool. 53 00:03:14,830 --> 00:03:19,390 We also don't want to destroy our zombies at the end of the round. 54 00:03:19,390 --> 00:03:22,870 We want to give them a different time to live. 55 00:03:23,170 --> 00:03:26,500 I'm going to do that by adding the debris service. 56 00:03:26,500 --> 00:03:29,350 Debris, right. 57 00:03:29,530 --> 00:03:31,270 That's game. 58 00:03:31,780 --> 00:03:34,840 Get service debris. 59 00:03:35,620 --> 00:03:37,840 And then I'm going to delete this line right here. 60 00:03:37,870 --> 00:03:46,900 I'm going to say debris, colon, ad item, and I want to put my zombie folder in there. 61 00:03:46,900 --> 00:03:51,730 So we're not going to kill the zombies off immediately or individually. 62 00:03:51,730 --> 00:03:55,330 We're going to do the whole folder just to keep this a little simpler. 63 00:03:55,660 --> 00:04:00,730 And then I need to get the time to live TTL dot value. 64 00:04:01,510 --> 00:04:03,040 And then what was our total? 65 00:04:03,040 --> 00:04:04,620 I like 45 or something, right? 66 00:04:04,630 --> 00:04:05,590 45 seconds. 67 00:04:05,590 --> 00:04:07,360 Yeah, 45 seconds. 68 00:04:07,360 --> 00:04:10,450 So they'll outlive our round by a little bit. 69 00:04:10,900 --> 00:04:13,220 All right, so intermission is 5 seconds. 70 00:04:13,240 --> 00:04:19,630 I think what I'm going to do is I'm going to make this wild loop periodically run throughout the game, 71 00:04:19,630 --> 00:04:22,390 doing the five second weights in between. 72 00:04:22,570 --> 00:04:28,450 Then if we get an update of our activated flag, so activate a dot value. 73 00:04:29,800 --> 00:04:33,980 So if this is true, we'll do the spawning. 74 00:04:34,000 --> 00:04:35,770 I'll put the end down here. 75 00:04:36,970 --> 00:04:39,430 Format selection, format document. 76 00:04:39,520 --> 00:04:40,780 So this is true. 77 00:04:40,810 --> 00:04:44,110 We'll do our spawning if this is false. 78 00:04:44,140 --> 00:04:48,580 Unchecked, we won't spawn, but we need to have some sort of wait. 79 00:04:48,580 --> 00:04:55,060 And here, even if this isn't going or will exhaust our resources the way will or the the loop will 80 00:04:55,060 --> 00:04:56,200 run too fast. 81 00:04:56,200 --> 00:04:59,590 And you're not going to share your resources with other things in the game. 82 00:04:59,590 --> 00:05:00,910 You're going to crash your game. 83 00:05:00,910 --> 00:05:03,970 So make sure you have some sort of wait in the loop. 84 00:05:04,090 --> 00:05:05,980 But 5 seconds is pretty good. 85 00:05:06,010 --> 00:05:07,480 Let's go ahead and try this out. 86 00:05:07,480 --> 00:05:08,440 Let's see what we got. 87 00:05:12,880 --> 00:05:13,270 All right. 88 00:05:13,270 --> 00:05:14,460 We should see some zombies. 89 00:05:14,470 --> 00:05:15,820 There's some zombies. 90 00:05:16,270 --> 00:05:21,760 I don't want to kill them all off because I want to make sure that we have two sets of zombies. 91 00:05:22,000 --> 00:05:24,760 Should be for, like, 15 seconds anyway. 92 00:05:24,820 --> 00:05:25,200 Watch this. 93 00:05:25,220 --> 00:05:25,860 Only get them all. 94 00:05:26,500 --> 00:05:27,280 All good. 95 00:05:27,580 --> 00:05:28,910 There's two hanging out. 96 00:05:28,930 --> 00:05:29,950 I couldn't help myself. 97 00:05:29,950 --> 00:05:30,810 I had to. 98 00:05:30,820 --> 00:05:31,900 I had to try to get it. 99 00:05:32,380 --> 00:05:34,040 Try to try to hide it. 100 00:05:34,120 --> 00:05:35,350 Try to kill the zombies. 101 00:05:35,830 --> 00:05:36,670 All right, here we go. 102 00:05:36,670 --> 00:05:37,750 We got three. 103 00:05:42,640 --> 00:05:45,070 Let's look for errors to view. 104 00:05:45,490 --> 00:05:46,490 Oh, here they come. 105 00:05:46,510 --> 00:05:47,710 There's no heirs. 106 00:05:48,870 --> 00:05:49,530 Nice. 107 00:05:49,530 --> 00:05:53,290 So they are living longer than the rounds. 108 00:05:53,320 --> 00:05:55,010 Our time to live is working. 109 00:05:55,020 --> 00:05:56,160 Should we try and get these? 110 00:05:56,160 --> 00:05:57,260 It'll be very satisfying. 111 00:05:57,270 --> 00:05:58,320 There's a whole bunch of them. 112 00:05:59,490 --> 00:06:02,160 Oh, man, I killed only one of them, I think. 113 00:06:02,160 --> 00:06:04,560 Anyway, I'll see you the next next video. 114 00:06:04,560 --> 00:06:06,060 We're going to do a sound. 115 00:06:06,060 --> 00:06:08,270 We're going to do an alarm for our boulder. 116 00:06:08,280 --> 00:06:08,730 Oh, no. 117 00:06:08,730 --> 00:06:11,010 Let's do an alarm for the zombies. 118 00:06:11,010 --> 00:06:14,220 When zombies spawn, we're going to have a klaxon go off. 119 00:06:14,550 --> 00:06:15,960 I thought that'd be pretty cool. 120 00:06:15,990 --> 00:06:17,820 I will see you in the next video.